/* 
 * Copyright (C) 2014 Krzysztof Troska <elleander86 at gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package anidbjclient;

/**
 *
 * @author Krzysztof Troska <elleander86 at gmail.com>
 */
public class AnidbException extends Exception {
    private static final long serialVersionUID = 1L;

    /**
     * Sets by defaul anidb to offline mode so we won't start again until we 
     * take care of it. ONLY this place can do this.
     */
    public AnidbException() {
        AnidbHandler.offlineMode = true;
        AnidbHandler.offlineTime = System.currentTimeMillis();
    }
    
    /**
     * Only fatal errors like 6** or 555 so we can log them or something.
     * @param msg 
     */
    public AnidbException(String msg) {
        this();
        System.out.format("Fatal anidb error:\n%s\n", msg);
    }
    
    /**
     * We don't want to go offline mode just write this for future repairs
     * @param msg msg from anidb server 
     * @param command command we send to anidb server
     */
    public AnidbException(String msg, String command) {
        System.out.format("Fatal anidb error:\n%s\nOur command:\n%s.", msg, command);
    }
}
